<?php
$this->pageTitle = Yii::app()->name;
$this->breadcrumbs=array(
	'供应商',
);
include_once('menu.php');
?>
<script>
function del(pid,name){
	if(!confirm('确认要删除:'+name)){
		return false;
	}
	$.post('<?php echo CHtml::normalizeUrl(array('/psi/delVendor'));?>',{'pid':pid}, function (data) {
        var ret = $.parseJSON(data);
        if (ret != null && ret.success != null && ret.success) {
			alert(ret.msg);
			location.reload(true);
        }
	});	
}
</script>
<div style="width:100%; float:left; margin-bottom:10px; text-align:right;">
	<form action="" name="jobForm" id="jobForm" method="get">
	<table width="100%" border="0" cellpadding="0" cellspacing="0">
		<tr>
			<td width="15%" class="td_right"><?php echo $labels['CompanyName']; ?>: </td>
			<td width="35%"><input type="text" name="CompanyName" value="<?php if(isset($search['CompanyName']))echo $search['CompanyName'];?>" id="CompanyName" class="input_size4" /></td>
			<td width="15%" class="td_right"><?php echo $labels['Contact']; ?>: </td>
			<td><input type="text" name="Contact" value="<?php if(isset($search['Contact']))echo $search['Contact'];?>" id="Contact" class="input_size4" /></td>			
		</tr>
		<tr>
			<td class="td_right"><?php echo $labels['CompanyPhone']; ?>: </td>
			<td><input type="text" name="CompanyPhone" value="<?php if(isset($search['CompanyPhone']))echo $search['CompanyPhone'];?>" id="ProductName" class="input_size4" /></td>			
			<td class="td_right"><?php echo $labels['Address']; ?>: </td>
			<td><input type="text" name="Address" value="<?php if(isset($search['Address']))echo $search['Address'];?>" id="Address" class="input_size4" /></td>
		</tr>	
		<tr>
			<td class="td_right"><?php echo $labels['QQNumber']; ?>: </td>
			<td><input type="text" name="QQNumber" value="<?php if(isset($search['QQNumber']))echo $search['QQNumber'];?>" id="QQNumber" class="input_size4" /></td>			
			<td class="td_right"><?php echo $labels['WWNumber']; ?>: </td>
			<td><input type="text" name="WWNumber" value="<?php if(isset($search['WWNumber']))echo $search['WWNumber'];?>" id="WWNumber" class="input_size4" /></td>
		</tr>	
	</table>
		<a style="margin-right:50px;" href="<?=Yii::app()->createUrl('psi/vendor')?>"><img src="images/shua.png" border="0" /></a>
		<input type="image" src="images/go.png" name="jobSub" id="jobSub" value="Go" />
		<input type="hidden" name="r" value="psi/vendor" />
	</form>
</div>
<table cellspacing="0" cellpadding="0" width="100%" class="tbl" style="float:left;">
	<tr class="head">
		<td width="12%"><?php echo $labels['VendorCode']; ?></td>
		<td width="30%"><?php echo $labels['CompanyName']; ?></td>
		<td width="10%"><?php echo $labels['CompanyPhone']; ?></td>
		<td width="24%"><?php echo $labels['Address']; ?></td>
		<td width="7%"><?php echo $labels['City']; ?></td>
		<td width="8%"><?php echo $labels['Contact']; ?></td>
		<td>详情</td>
	</tr>
	<?php
    $i = 0;
    $cssArr = array(0 => 'even', 1 => 'odd', 2 => 'three');
    foreach ($rowTable as $item) {
        $trClass = $cssArr[$i % 3];
        $i++;
        ?>
	<tr class="<?= $trClass ?>">
		<td style="text-align:center;">
			<?=$item->VendorCode?>
		</td>
		<td>
			<?=$item->CompanyName?>
		</td>
		<td>
			<?=$item->CompanyPhone?>
		</td>
		<td>
			<?=$item->Address?>
		</td>
		<td>
			<?=$item->City?>
		</td>
		<td>
			<?=$item->Contact?>
		</td>
		<td style="text-align:center;">
			<a href="<?=Yii::app()->createUrl('psi/updateVendor',array('id'=>$item->ID))?>">详情</a>
		</td>
	</tr>
	<?php
    }
    ?>
</table>
<div id="pager" align="center">
<?php  
	$this->widget('CLinkPager',array(  
		'header'=>'',  
		'firstPageLabel' => '<<',
		'lastPageLabel' => '>>',
		'prevPageLabel' => '<',
		'nextPageLabel' => '>',
		'pages' => $pages,  
		'maxButtonCount'=>13  
		));  
?>
</div>